package com.zcsy.manage.owner.service.system.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcsy.manage.model.system.User;
import com.zcsy.manage.owner.service.system.IOUserService;
import com.zcsy.manage.persistence.system.UserDao;

/**
 * @Title: UserService.java
 * @Package： com.zcsy.manage.owner.service.system.impl 
 * @Description: 用户登录service层实现类
 *
 * @author caiyinli 13277030520@163.com
 * @Copyright: 2015 武汉中财数元信息技术有限公司 All rights reserved.
 * @date 2016年6月23日
 * @version 1.0
 * @see JDK1.7.0_75
 * @since
 */
@Service
public class OUserService implements IOUserService {

	@Autowired
	private UserDao UserDao;
	
	@Override
	public User ownerUserLogin(User user) {
		return UserDao.ownerUserLogin(user);
	}
	
	@Override
	public List<User> selectUserIfPhoneExists(String phone, int type) {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("phone", phone);
		map.put("type", type);
		return UserDao.selectUserIfPhoneExists(map);
	}

	@Override
	public User userLogin(User user) {


		return UserDao.userLogin(user);
	}

	@Override
	public int updateInformation(User user) {	
		return UserDao.updateInformation(user);
	}

	@Override
	public int changePwd(User user) {
		return UserDao.changePwd(user);
	}

	@Override
	public User selectByPrimaryKey(String id) {
		return UserDao.selectByPrimaryKey(id);
	}

	@Override
	public User selectByLoginName(String name) {
		return UserDao.selectByLoginName(name);
	}

	@Override
	public User selectByPhone(String phone) {
		return UserDao.selectByPhone(phone);
	}


	@Override
	public int forgetPass(String pwd, String loginname) {
		return UserDao.forgetPass(pwd, loginname);
	}

	@Override
	public List<String> selectRoleMenu(String roleid) {
		return UserDao.selectRoleMenu(roleid);
	}

	@Override
	public String selectLoginNameByPhone(String phone) {
		return UserDao.selectLoginNameByPhone(phone);
	}


	@Override
	public int boundPhone(String phone, String loginname) {
		return UserDao.boundPhone(phone, loginname);
	}
}
